package com.zhengaz.service.blog.controller.api;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zhengaz.common.core.constant.Constants;
import com.zhengaz.common.core.entity.R;
import com.zhengaz.service.blog.entity.BlogTypeEntity;
import com.zhengaz.service.blog.service.BlogTypeService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhengzg
 * @create 2023-11-26 14:28
 */
@RestController
@RequestMapping(Constants.API + "/blog-type")
public class BlogTypeController {

    Logger log = LoggerFactory.getLogger(BlogTypeController.class);

    @Resource
    private BlogTypeService blogTypeService;

    @GetMapping("")
    @ApiOperation("获取所有类别")
    public R<List<BlogTypeEntity>> list() {
        return R.ok(blogTypeService.list(Wrappers.<BlogTypeEntity>lambdaQuery().orderByAsc(BlogTypeEntity::getOrderNumber)));
    }
}
